﻿$(function(){
		   
		   
   var pagesComm = {
    search : function (){
       var searchForm = document.getElementById("search_form"), 
		   input = document.getElementById("search_input"),
           inputValue = input.value,
           submitSite = document.getElementById("search_icon"),
	       str = null;

       input.onfocus = input.onclick = function (){
		   if(this.value == inputValue){
			   this.value = '';
               this.style.backgroundImage = 'none';
			}
       };
       input.onkeyup = function (){
            str = encodeURI(this.value.trim());
       };
       searchForm.onsubmit = function (e){
		    if(str){
               this.action = 'http://search.microsoft.com/results.aspx?mkt=zh-cn&setlang=zh-cn&q=' + str + '&form=MSSBCUS'
			}
			else{
			   stopDefault ( e )
			};
       }
       submitSite.onclick = function (e){
		   if(str){
               searchForm.action = 'http://search.microsoft.com/results.aspx?mkt=zh-cn&setlang=zh-cn&q=' + str + '&form=MSSBCUS';
		   }
			else{
			   stopDefault ( e )
			};
       };
       input.onblur = function (){
		   if(this.value.trim().length <= 1){
             this.value = inputValue;
			 //this.style.backgroundImage = 'url(http://i3.microsoft.com/en-us/office365/shared/templates/components/o365SearchBar/images/logo_inside.gif)';
		   }
       };
    }};
	pagesComm.search();
	
		
	// 首页弹出效果--交通	
	$("#traffic,#traffic_arrow").hover(function(){
		$("#traffic_mouseover").show();
	},function(){
		$("#traffic_mouseover").hide();
	});
	// 首页弹出效果--酒店	
	$("#hotel,#hotel_arrow").hover(function(){
		$("#hotel_mouseover").show();
	},function(){
		$("#hotel_mouseover").hide();
	});
	// 首页弹出效果--政府及公共事业	
	$("#public,#public_arrow").hover(function(){
		$("#public_mouseover01,#public_mouseover02,#public_mouseover03").show();
	},function(){
		$("#public_mouseover01,#public_mouseover02,#public_mouseover03").hide();
	});
	// 首页弹出效果--能源
	$("#energy,#energy_arrow").hover(function(){
		$("#energy_mouseover").show();
	},function(){
		$("#energy_mouseover").hide();
	});
	// 首页弹出效果--旅游	
	$("#travel,#travel_arrow").hover(function(){
		$("#travel_mouseover").show();
	},function(){
		$("#travel_mouseover").hide();
	});
	// 首页弹出效果--金融
	$("#financial,#financial_arrow").hover(function(){
		$("#financial_mouseover").show();
	},function(){
		$("#financial_mouseover").hide();
	});
	// 首页弹出效果--医疗
	$("#medical,#medical_arrow").hover(function(){
		$("#medical_mouseover").show();
	},function(){
		$("#medical_mouseover").hide();
	});
	
	
	// 点击相应页面，红色背景选中
	if($("body").hasClass("default")){		
       	$('#nav>li>a').eq(0).attr("class","sel");	
    }
	if($("body").hasClass("casestudy")){		
       	$('#nav>li>a').eq(1).attr("class","sel");	
    }
	if($("body").hasClass("download-center")){		
       	$('#nav>li>a').eq(2).attr("class","sel");
    }
	if($("body").hasClass("vle")){		
       	$('#nav>li>a').eq(3).attr("class","sel");	
    }
	
	
	// 黑色导航菜单下拉
	$("#success_case").hover(function(){
		$(this).find('div.red_nav').show();
		$("#success_case>a").attr("class","sel");
	},function(){
		$(this).find('div.red_nav').hide();
		$("#success_case>a").attr("class","nosel");
	});
	
	
	$("#learn_more").hover(function(){
		$(this).find('div.red_nav').show();
		$("#learn_more>a").attr("class","sel");
	},function(){
		$(this).find('div.red_nav').hide();
		$("#learn_more>a").attr("class","nosel");
	});
	// 红色导航菜单下拉
	$(".red_navmenu>li").each(function(i){
		$(".red_navmenu>li").hover(function(){
			if($(this).index()==i){
				$(this).find("div.black_nav").show();
				$(this).addClass("red_navmenu_li_ie6");
			}
		},function(){
			if($(this).index()==i){
				$(this).find("div.black_nav").hide();
				$(this).removeClass("red_navmenu_li_ie6");
			}	
		});
	});
	
	
	// download-center页面
	$(".branch_link").eq(0).hover(function(){
		$(".branch_link>img").eq(0).attr("src","images/branch_img01_mouseover.jpg");
		$(".branch_link>span").eq(0).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(0).attr("src","images/branch_img01.jpg");
		$(".branch_link>span").eq(0).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(1).hover(function(){
		$(".branch_link>img").eq(1).attr("src","images/branch_img02_mouseover.jpg");
		$(".branch_link>span").eq(1).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(1).attr("src","images/branch_img02.jpg");
		$(".branch_link>span").eq(1).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(2).hover(function(){
		$(".branch_link>img").eq(2).attr("src","images/branch_img03_mouseover.jpg");
		$(".branch_link>span").eq(2).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(2).attr("src","images/branch_img03.jpg");
		$(".branch_link>span").eq(2).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(3).hover(function(){
		$(".branch_link>img").eq(3).attr("src","images/branch_img04_mouseover.jpg");
		$(".branch_link>span").eq(3).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(3).attr("src","images/branch_img04.jpg");
		$(".branch_link>span").eq(3).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(4).hover(function(){
		$(".branch_link>img").eq(4).attr("src","images/branch_img05_mouseover.jpg");
		$(".branch_link>span").eq(4).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(4).attr("src","images/branch_img05.jpg");
		$(".branch_link>span").eq(4).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(5).hover(function(){
		$(".branch_link>img").eq(5).attr("src","images/branch_img06_mouseover.jpg");
		$(".branch_link>span").eq(5).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(5).attr("src","images/branch_img06.jpg");
		$(".branch_link>span").eq(5).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(6).hover(function(){
		$(".branch_link>img").eq(6).attr("src","images/branch_img07_mouseover.jpg");
		$(".branch_link>span").eq(6).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(6).attr("src","images/branch_img07.jpg");
		$(".branch_link>span").eq(6).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(7).hover(function(){
		$(".branch_link>img").eq(7).attr("src","images/branch_img08_mouseover.jpg");
		$(".branch_link>span").eq(7).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(7).attr("src","images/branch_img08.jpg");
		$(".branch_link>span").eq(7).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(8).hover(function(){
		$(".branch_link>img").eq(8).attr("src","images/branch_img09_mouseover.jpg");
		$(".branch_link>span").eq(8).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(8).attr("src","images/branch_img09.jpg");
		$(".branch_link>span").eq(8).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(9).hover(function(){
		$(".branch_link>img").eq(9).attr("src","images/branch_img10_mouseover.jpg");
		$(".branch_link>span").eq(9).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(9).attr("src","images/branch_img10.jpg");
		$(".branch_link>span").eq(9).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(10).hover(function(){
		$(".branch_link>img").eq(10).attr("src","images/branch_img11_mouseover.jpg");
		$(".branch_link>span").eq(10).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(10).attr("src","images/branch_img11.jpg");
		$(".branch_link>span").eq(10).removeClass("branch_text_mouseover");
	});
	$(".branch_link").eq(11).hover(function(){
		$(".branch_link>img").eq(11).attr("src","images/branch_img12_mouseover.jpg");
		$(".branch_link>span").eq(11).addClass("branch_text_mouseover");
	},function(){
		$(".branch_link>img").eq(11).attr("src","images/branch_img12.jpg");
		$(".branch_link>span").eq(11).removeClass("branch_text_mouseover");
	});
	
	
	// 图片放大镜
	var picturesSmallHeight = $(".pictures_small>img").height();
	var glassMask = $(".glass_mask");
	glassMask.css("height",picturesSmallHeight);
	var glassMaskHeight = glassMask.css("height");	
	$(".glass_icon").css("top",(picturesSmallHeight-87)/2);
	// 上一页和下一页的定位
	$(".arrow_left").css("top",(picturesSmallHeight-47)/2);
	$(".arrow_right").css("top",(picturesSmallHeight-47)/2);
	// 小图片蒙版
	$(".pictures_small").hover(function(){
		$(".glass_mask").show();
		$(".glass_icon").show();
	},function(){
		$(".glass_mask").hide();
		$(".glass_icon").hide();
	});
	// 大蒙版显示
	$(".pictures_small,.magnifier_icon").click(function(){
		$(".mask").show();
	});
	//	大蒙版消失
	$(".close_icon").click(function(){
		$(".mask").hide();
	});
	
	
});